import { defineStore } from 'pinia'

type SystemStoreType = {
  systemInfo: any
  systemSettings: any
  navigationBarInfo: any
}

export const useSystemStore = defineStore<string, SystemStoreType>('systemStore', {
  state: () => {
    return {
      systemInfo: {},
      systemSettings: {},
      navigationBarInfo: {}
    }
  },
  getters: {},
  actions: {
    /* 获取系统信息 */
    getSystemInfo() {
      this.systemInfo = uni.getSystemInfoSync()
      return this.systemInfo
    },
    /* 获取系统设置信息 */
    getSystemSettings() {
      this.systemSettings = uni.getSystemSetting()
      return this.systemSettings
    },
    /* 获取胶囊信息 */
    getNavigationBarInfo() {
      this.navigationBarInfo = uni.getMenuButtonBoundingClientRect()
      return this.navigationBarInfo
    }
  }
})
